#include "Defines.h"
#include <stdio.h>

#include "Tests/ParseSymbolsTest.h"
#include "Tests/StatsTests.h"
#include "Tests/SQLTests.h"

typedef result_type (*test_func)(void);

typedef struct
{
    test_func function;
    const char* name;
} test_node;

test_node test_list[] = 
{
    //{&parse_symbols_spot_test, "Parse Symbols and Print"},
    //{&parse_html_simple, "simple html parsing test"},
    //{&parse_html_spot_test, "html parse output"}
    //{&date_to_int_test, "Date Conversion Test"}
    //{&send_data_test, "send data test"},
    //{&get_data_test, "get data test"}
    {&date_conversion_test, "Date format conversion"}
    //<List of (&function_names, "test titles") here>
};

int main()
{
    int i;
    result_type result;

    //TODO: add some soft of header print

    for(i = 0; i < sizeof(test_list)/sizeof(test_node); i++)
    {
        result = test_list[i].function();
        printf(test_list[i].name);
        printf("\t\t");
        switch(result)
        {
            case SUCCESS:
                printf("SUCCESS");
                break;
            case FATAL_ERROR:
                printf("FATAL ERROR");
                break;
            case END_OF_DATA:
                printf("END OF DATA INDICATED");
                break;
            case CONNECTION_ERROR:
                printf("CONNECTION_ERROR");
                break;
            case GENERAL_ERROR:
                printf("GENERAL ERROR");
                break;
            case UNDEFINED:
                printf("UNDEFINED");
                break;
            case SPOT_CHECK:
                printf("MANUAL CHECK REQUIRED");
                break;
            default:
                printf("UNKNOWN RETURN");
                break;
        }
        printf("\n");
    }
    printf("\ntests complete\n");
    return 0;
};
